package com.youxue.dao;

import com.youxue.entity.Interaction;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface InteractionMapper {
    int deleteByPrimaryKey(Integer interactionId);

    int insert(Interaction record);

    int insertSelective(Interaction record);

    Interaction selectByPrimaryKey(Integer interactionId);

    int updateByPrimaryKeySelective(Interaction record);

    int updateByPrimaryKey(Interaction record);

    List<Interaction> showOnePersonReview(@Param(value = "dynamicId") Integer dynamicId, @Param(value = "replayId") Integer replayId);

    int insertReview(@Param(value = "interactionUserId") Integer interactionUserId, @Param(value = "dynamicId") Integer dynamicId,
                     @Param(value = "replayId") Integer replayId, @Param(value = "dynamicComment") String dynamicComment);




    /**
     * 查询所有未读信息列表（不分页）
     * @param replayId
     * @return
     */
    List<Interaction> whatchMyNews(@Param(value = "replayId") Integer replayId);

    /**
     * 查询所有未读信息总数
     * @param replayId
     * @return
     */
    int selectMyNewsCount(@Param(value = "replayId") Integer replayId);
    /**
     * 删除一条直接评论
     * @param interactionId
     * @return
     */
    int deleteAImmediateComment( @Param(value = "interactionId")Integer interactionId);

    /**
     * 查询一条动态所有评论（分页）
     * @param dynamicId
     * @param startPos
     * @param pageSize
     * @return
     */
    List<Interaction> selectADynamicAllCommentByPage(@Param(value = "dynamicId") Integer dynamicId,@Param(value = "startPos") Integer startPos, @Param(value = "pageSize") Integer pageSize);

    /**
     * 查询一条动态所有直接评论总条数（分页）
     * @param dynamicId
     * @param dynamicId
     * @return
     */
    int selectADynamicAllCommentCount(@Param(value = "dynamicId") Integer dynamicId);

    /**
     * 查询一条评论下的所有回复条数
     * @param interactionId
     * @return
     */
    int selectACommentAllInteractionCount(Integer interactionId);

    /**
     * 查询一条评论下所有回复列表，分页显示
     * @param interactionId
     * @param startPos
     * @param pageSize
     * @return
     */
    List<Interaction> selectACommentAllInteractionByPage(@Param(value = "interactionId") Integer interactionId,@Param(value = "startPos") Integer startPos, @Param(value = "pageSize") Integer pageSize);

    /**
     * 将一条消息设为已读
     * @param interactionId
     * @return
     */
    int  updateAInteractionRead(Integer interactionId);

    /**
     * 将多条消息设为已读
     * @param replayId
     * @return
     */
   int updateListInteraction(@Param(value = "replayId") Integer replayId);

    /**
     * 删除一条动态下的所有评论与回复（在用户删除动态时使用）
     * @param dynamicId
     * @return
     */
   int  deleteInteractions(@Param(value = "dynamicId") Integer dynamicId);

    /**
     * 查询一条动态评论详情
     * @param interactionId
     * @return
     */
    Interaction selectAInteractionInfo(Integer interactionId);
}